function _wiic_api_usersgames($username) {
	$rc = new stdClass();
	$rc->function = 'usersgames';
	$rc->username = $username;
	// fetch uid
	$userid = db_fetch_object(db_query("select uid from {users} where name = '%s'", $username));
	$rc->uid = $userid->uid;
	$rc->games = array();
	// fetch games
  $query= "SELECT n.title, n.nid, v.value rating, w.code gamecode, w.comment FROM {node} n 
                    inner join {flag_content} fc on n.nid = fc.content_id 
                    inner join {flags} f on fc.fid = f.fid
                    left join {votingapi_vote} v on v.content_id = n.nid and v.content_type = 'node' 
                                                  and v.uid = {$userid->uid} and v.value_type = 'percent'
                    left join {wiiclubcodes} w on w.uid = {$userid->uid} AND w.gamenid = n.nid
                    WHERE fc.uid = {$userid->uid} AND f.name = 'meinespiele' ORDER BY n.title";
  if ($userid) {
  	//print_r($query);
    $result = db_query($query);
  	while ($game = db_fetch_object($result)) {
  		 //print_r($game);
  		 $game->link = url('node/'.$game->nid);
  	   $rc->games[] = $game;
  	}
  }
	
	// dont return caue we dont want drupal to render 
	print json_encode($rc); die; 
}